package Netloadin;

use WWW::Mechanize;

sub upload
{

	my $local_files = shift;
	my @local_files = @$local_files;
	my @download_links = ();
	
	foreach my $local_file (@local_files)
	{
		my $mech = WWW::Mechanize->new();

		my $cookie_jar = HTTP::Cookies->new(
			file => $::spreader_cookie_dir."netloadin.dat",
			autosave => 1,
		  );
		
		$mech->cookie_jar($cookie_jar);
		
		$textbox_content =  "ftp://".$::spreader_ftp_user.":".$::spreader_ftp_pwd."\@".$::spreader_ftp_ip.$::spreader_ftp_path.$local_file."\n";
	
		$mech->get("http://www.netload.in/");


	
		
		$mech->form_number(1);
		$mech->field("txtuser" => "chrille790");
		$mech->field("txtpass" => "bowling1");
		$mech->field("txtcheck" => "login");
		$mech->field("txtlogin" => "");
		$mech->submit();
		
		
		$mech->get("http://www.netload.in/");
		# foreach ($mech->forms())
		# {
			# print $_->dump;
			# print "\n\n";
		# }
		my @content = $mech->content;
		foreach (@content) {
			print $_ . "\n\n";
		}
		
		
		exit;
		my @content = $mech->content;
		foreach (@content) {
			if ($_ =~ /http:\/\/www.fast-load.net\/index.php\?pid=([^&"\n\r<]*)/) {
				push(@download_links, "http://www.fast-load.net/index.php?pid=$1");
			}
		}
	}
	return @download_links;
}

1;